#include <bits/stdc++.h>
using namespace std;

bool check(int de, int nu){
    int bit = 0;
    if(de<10000) bit^=1;
    do{
        int remain = de%10;
        bit ^= 1<<remain;
    }while(de /=10);

    if(nu<10000) bit^=1;
    do{
        int remain = nu%10;
        bit ^= 1<<remain;
    }while(nu /=10);

    return bit == ((1<<10) - 1);
}
int main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);
    int N, T = 0;
    while(cin >> N && N){
        if(++T>1) cout << "\n";
        bool have = false;
        for (int nu = 1234; nu <= 98765; ++nu) {
            int de = nu * N;
            if(de > 98765) break;
            if(check(de, nu)){
                if(!have) have = true;
                if(de<10000) cout << "0"; cout  << de;
                cout << " / ";
                if(nu<10000) cout << "0"; cout  << nu;
                cout << " = " << N << "\n";
            }
        }
        if(!have) cout << "There are no solutions for " << N << ".\n";
    }

    return 0;
}